package api

import (
	"gitee.com/go-mid/booter/bootservice"
	"gitee.com/go-mid/booter/web"
	"gitee.com/xserv/goldrush/goldrushcontroller"
)

func RegisterDemoHttpServer(serv *bootservice.HttpServer, preInterceptors []bootservice.HandlerFunc, postInterceptors []bootservice.HandlerFunc) {

	//原始的请求，什么都不处理
	serv.POST("/demo/testraw", WithInterceptor(goldrushcontroller.DemoRaw, preInterceptors, postInterceptors)...)
	// 原始请求，不处理请求体，但是会把请求头解析出来, 响应的是字符串
	serv.POST("/demo/testcomm", WithInterceptor(web.HttpRequestWrapper(goldrushcontroller.FactoryDemoXfrmRequest), preInterceptors, postInterceptors)...)
	//测试不使用前后的拦截器
	serv.POST("/demo/testjsonNoInterceptor", web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoXfrmRequest))
	//测试各种响应的方式
	serv.POST("/demo/testwriter", web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoWriterRequest))
	//测试各种响应的方式
	serv.GET("/demo/testwriter", web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoWriterRequest))
	//测试文件上传
	serv.POST("/demo/testfile", web.HttpRequestWrapper(goldrushcontroller.FactoryDemoFileRequest))
	//测试多文件上传
	serv.POST("/demo/testmulfile", web.HttpRequestWrapper(goldrushcontroller.FactoryDemoMulFileRequest))
	//测试表单提交方式
	serv.POST("/demo/testform", web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoFormRequest))
	//测试配置信息获取
	serv.POST("/demo/testconf", web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoConfRequest))
	//测试原始的表单提交方式
	serv.POST("/demo/testform2", goldrushcontroller.DemoForm2Request)
	//测试登录态
	serv.POST("/base/demo/testlogin", WithInterceptor(web.HttpRequestMarshalBodyWrapper(goldrushcontroller.FactoryDemoLoginRequest), preInterceptors, postInterceptors)...)
}
